package util;

import java.util.Locale;
import java.util.Random;
import java.util.UUID;

/**
 * @Description
 * @Author liufei
 * @Date 2021/9/18 1:37
 */
public class SidMacGenerator {
    public static void main(String[] args) {
//        String s = "LIO-AN005dd4944fc7e37370";
        String replace = UUID.randomUUID().toString().replace("-", "");
        String sid = replace.substring(0, 3).toUpperCase(Locale.ROOT) + "-" + replace.substring(3, 20);
        String mac = mac(6);
        System.out.println(sid);
        System.out.println(mac);
    }

    private static final Character[] temp = new Character[]{
            '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
    };
    private static final Random random = new Random(System.currentTimeMillis());

    private static String mac(int gCount) {
        StringBuilder mac = new StringBuilder();
        for (int i = 0; i < gCount; i++) {
            if (mac.length() > 0) {
                mac.append(":");
            }
            mac.append(temp[random.nextInt(16)]).append(temp[random.nextInt(16)]);
        }
        return mac.toString();
    }
}
